home *** CD-ROM | disk | FTP | other *** search
- #ifndef _H_IMPL_SPEC
- #define _H_IMPL_SPEC
-
- #ifndef lint
- static const char impl_spec_sccsid[]="%W% %G% %U%:Component-%Y% %Q%";
- #endif // lint
- #include <limits.h>
-
- const int IMPL_TABLE_INCR = 10 ;
- const int MAX_UID = SHRT_MAX ;
-
- // The following type definitions are declared global, instead of nested
- // because, the order (and number ) of calls that are made to static
- // constructors and destructors by Cfront generated code is sometimes
- // incorrect. Hence, depend upon a globally initialized variable.
- typedef struct impl_map_entry_s
- {
- int uid ;
- const char *name ;
- } impl_map_entry_t ;
-
- typedef struct impl_map_s
- {
- int index ;
- int size ;
- impl_map_entry_t *entries ;
- } impl_map_t ;
-
- // The implsepec class manages the globally common data structures that are
- // used to maintain the class uid information. These structures normally
- // would be made static.
- class ImplSpec : public virtual CLASS
- {
- public :
- ImplSpec() ;
- ImplSpec(const char *) ;
- virtual ~ImplSpec() ;
- virtual int operator == (ImplSpec & ) { return -1 ; } ;
- virtual int operator == (ImplSpec * ) { return -1; } ;
- virtual int operator == (int & ) { return -1; } ;
- virtual int operator != (ImplSpec &) { return -1; } ;
- virtual int operator != (ImplSpec *) { return -1 ;} ;
- virtual int operator != (int &) { return -1 ;} ;
- virtual operator int () { return 0; } ;
- int getuid(int n) { return ((id << 16) + n) ; } ;
- RTTI_SCAFFOLDING_DECL(ImplSpec)
-
- private :
- // private meta-data
- impl_map_t *table ;
- impl_map_entry_t *alloc_entries(void ) ;
- int id ;
- void init_tab(void ) ;
- impl_map_entry_t *find_name(const char *) ;
- impl_map_entry_t *register_name(const char *) ;
- int is_index_valid(void ) ;
- } ;
-
- // The following class actually provides the front-end interface
- // for managing implmentation information.
- class BaseImplSpec : public ImplSpec
- {
- public :
- BaseImplSpec(int,const char * ) ;
- ~BaseImplSpec() { } ;
- virtual int operator== (ImplSpec &) ;
- virtual int operator== (ImplSpec *) ;
- virtual int operator== (int &) ;
- virtual int operator!= (ImplSpec &) ;
- virtual int operator!= (ImplSpec *) ;
- virtual int operator!= (int &) ;
- virtual ImplSpec &operator = (int ) ;
- virtual ImplSpec &operator = (ImplSpec &) ;
- virtual operator int () ;
- RTTI_SCAFFOLDING_DECL(BaseImplSpec)
- private :
- int type ;
- } ; // a specification of the Base Implementation category
-
-
-
- #endif // _H_IMPL_SPEC
-